<template>
	<view class="tab">
		<view v-for="(item,index) in tabArr" :key="index" class="tab-item" :class="{active:currentTabIndex==index}" @click="onItemClick(index)">
			<text>{{item.title}}</text>
		</view>
	</view>
</template>

<script>
	export default{
		props: {
			tabArr: Array,
			currentTabIndex: Number
		},
		methods: {
			onItemClick (index) {
				this.$emit('onClick',{index})
			}
		}
	}
</script>

<style lang="scss">
	.tab{
		width: 710rpx;
		margin: 0 auto;
		height: 80rpx;
		line-height: 80rpx;
		background-color: #fff;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		font-size: 26rpx;
		color: #999;
	}
	.tab-item{
		text-align: center;
		padding-bottom: 16rpx;
	}
	.active{
		color: $uni-color-primary;
		border-bottom: solid $uni-color-primary 4rpx;
	}
</style>
